<script>
frm.ajajform("insertWidget",null,null,{
	type:"label",
	label:"{{!Checkout summ}}",
	name:"calc_summ",
	value:{{JSON:item.calc_summ}},
	xpath:".main-block"
});
frm.ajajform("insertWidget",null,null,{
	type:"label",
	label:".",
	name:"resend_to_manager",
	value:'<input type="button" value="{{!Resend email to manager}}" onclick="ajaj_href(\'/admin-AdminMarket/?mode=resend_email&ajaj=1&cart_id={{fields.id}}\')";return false;>',
	html:1,
	xpath:".main-block"
});
frm.ajajform("insertWidget",null,null,{
	type:"label",
	label:".",
	name:"resend_to_user",
	value:'<input type="button" value="{{!Resend email to user}}" onclick="ajaj_href(\'/admin-AdminMarket/?mode=resend_email&ajaj=1&cart_id={{fields.id}}&user_id={{item.user_id}}\')";return false;>',
	html:1,
	xpath:".main-block"
});
{{if state_up}}
frm.ajajform("insertWidget",null,null,{
	type:"label",
	label:".",
	name:"state_up",
	value:'<input type="button" value="{{!Up to}}: {{state_up.name}}" onclick="ajaj_href(\'/admin-AdminMarket/?mode=cart_state_set&ajaj=1&cart_id={{fields.id}}&state_id={{state_up.id}}\')";return false;>',
	html:1,
	xpath:".main-block"
});
{{/if}}
$("#frm-sid").hide();

var grid=frm.ajajform("insertWidget",null,null,{
	type: "grid",
	rowSelection: true,
	title: "{{!Items}}",
	name: "items",
	post: "json",
	mode: "form-edit-full",
	rowClasses: [{
		name:"item",
		columns: [
			{name: "id", label: "{{!ID}}", width: 80,readOnly:1,html:1},
			{name: "name", label: "{{!Name}}", width: 400,readOnly:1},
			{name: "category_name", label: "{{!Category}}", width: 200,readOnly:1},
			{name: "manufacturer_name", label: "{{!Manufacturer}}", width: 200,readOnly:1},
			{name: "price", label: "{{!Price}}", width: 100,readOnly:1},
			{name: "price_now", label: "{{!Price now}}", width: 100,readOnly:1},
			{name: "amount", label: "{{!Amount}}", width: 100}
		]
	}]
});
var cart_items={{JSON:cart_items}};
for (var i=0;i<cart_items.length;i++) {
	var ci=cart_items[i];
	grid.ajajform_grid("insertRow",null,{rowClass: "item",cells:["<a href='/market/category/"+ci.category_code+"/"+ci.code+"/'>"+ci.id+"</a>",ci.name,ci.category_name,ci.manufacturer_nanme,ci.price,ci.price_now,ci.amount],id:ci.id});
}
</script>
